//: Playground - noun: a place where people can play

import Cocoa

var str = "Hello, playground"

var trafficLight = "Red"

if trafficLight == "Red" {
    print("Stop!")
} else {
    print("Go!")
}

var number1 : Int = 33
var number2 : Int = 101

if number1 >= number2 {
    print("\(number1) is greater than \(number2)")
} else {
    print("\(number1) is less than \(number2)")
}

let tree1 = "Oak"
let tree2 = "Pecan"
let tree3 = "Maple"

let treeCompare1 = tree1 > tree2
let treeCompare2 = tree2 > tree3

var treeArray = [tree1, tree2, tree3]

for tree in treeArray {
    if tree == "Oak" {
        print("Furniture")
    }
    else if tree == "Pecan" {
        print("Pie")
    }
    else if tree == "Maple" {
        print("Syrup")
    }
}

treeArray += ["Cherry"]

for tree in treeArray {
    switch tree {
        case "Oak":
            print("Furniture")
        case "Pecan", "Cherry":
            print("Pie")
        case "Maple":
            print("Syrup")
        default:
            print("Wood")
    }
}

var position = 8

switch position {
    case 1:
        print("\(position)st")
    
    case 2:
        print("\(position)nd")

    case 3:
        print("\(position)rd")

    case 4...9:
        print("\(position)th")

    default:
        print("Not covered")
}

var base = 2
var target = 1000
var value = 0

while value < target {
    value += base
}

repeat
{
    value += base
} while value < target;

// Speed Limit Simulation
var speedLimit = 75
var carSpeed = 0

while carSpeed < 100 {
    carSpeed++
    
    switch carSpeed {
    case 0..<20:
        print("\(carSpeed): You're going really slow")
        
    case 20..<30:
        print("\(carSpeed): Pick up the pace")
        
    case 30..<40:
        print("\(carSpeed): Tap the accelerator")
        
    case 40..<50:
        print("\(carSpeed): Hitting your stride")
        
    case 50..<60:
        print("\(carSpeed): Moving at a good clip")
        
    case 60..<70:
        print("\(carSpeed): Now you're cruising!")

    case 70...speedLimit:
        print("\(carSpeed): Warning... approaching the speed limit")

    default:
        print("\(carSpeed): You're going too fast!")
    }
    
    if carSpeed > speedLimit {
        break
    }
}
